package com.zc.core;

import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * Created by zhangchi9 on 2016/11/10.
 */
@Configuration
@ComponentScan(basePackages = "com.zc")
@PropertySources({@PropertySource(value = "classpath:props/jdbc.properties")})
@EnableAspectJAutoProxy(proxyTargetClass=true)//激活切面AOP
public class ApplicationConfig {
    /**
     * PropertySourcesPlaceholderConfigurer 需配合@value注解使用，方可获取文件内用。    提倡使用使用Environment获取文件中内容。
     * @Value("${db.type}")
     * private String dbType;
     *
     * @Autowired
     * Environment environment;
     * environment.getProperty("sql.map.config.file")
     * @return
     */
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}
